#!/usr/bin/env python
import pika

credentials = pika.PlainCredentials(username='chf', password='123456')  # mq用户名和密码
connection = pika.BlockingConnection(pika.ConnectionParameters(host='117.72.79.182', port=5672, credentials=credentials))

channel = connection.channel()

channel.queue_declare(queue='hello')

channel.basic_publish(exchange='', routing_key='hello', body='Hello World!')
print(" [x] Sent 'Hello World!'")
connection.close()


